<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Aquamat: Dokumentacja pliku log.c</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Wygenerowano przez Doxygen 1.6.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Strona&nbsp;główna</span></a></li>
      <li><a href="pages.html"><span>Dodatkowe&nbsp;strony</span></a></li>
      <li><a href="annotated.html"><span>Struktury&nbsp;Danych</span></a></li>
      <li class="current"><a href="files.html"><span>Pliki</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>Lista&nbsp;plików</span></a></li>
      <li><a href="globals.html"><span>Globalne</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>Dokumentacja pliku log.c</h1><h3>(r58/r57)</h3>
<p>Implementacja loga systemowego.  
<a href="#_details">Więcej...</a></p>
<code>#include &lt;avr/wdt.h&gt;</code><br/>
<code>#include &quot;<a class="el" href="aquamat_8h_source.html">aquamat.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="twi_8h_source.html">twi.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="log_8h_source.html">log.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="strings_8h_source.html">strings.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="usart_8h_source.html">usart.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="hd44780_8h_source.html">hd44780.h</a>&quot;</code><br/>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Funkcje</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint16_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="log_8c.html#a3738b2ee3ff807b7d474a41d2e3ac718">log_read_pointer</a> (void)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="log_8c.html#a2e029451a7bcce372537c4c50805a4df">log_write_pointer</a> (uint16_t pointer)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="log_8c.html#adc6300536924bb78d7e3d0edff452241">log_write_record</a> (uint8_t type, uint8_t val1, uint8_t val2, uint8_t val3)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="log_8c.html#a88d1aa3d831dc4457de385a06552303b">log_write_record_at_pointer</a> (uint16_t logp, uint8_t type, uint8_t val1, uint8_t val2, uint8_t val3)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="log_8c.html#a06b5b6528e09e9739123d051949bfef5">log_clear_record</a> (uint16_t logp)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="log_8c.html#a7ec3e7bfdff671647c3b5f970e269416">log_clear</a> (void)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="log_8c.html#ae936d9a5aed8334fd48eb6951c71e4d5">log_read_record_at_pointer</a> (uint16_t logp, uint8_t *pbuff)</td></tr>
<tr><td colspan="2"><h2>Zmienne</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint8_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="log_8c.html#a7acca8be0094a19be6e308ac05924c4f">minutes</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint8_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="log_8c.html#a00a531a34a1d603329df5778f1203ab6">hours</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint8_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="log_8c.html#a3cc119cb1a4beab046568bd21fcac3e5">temp</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint8_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="log_8c.html#a7af2065789bc84419b8d5fe109be83b5">year</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint8_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="log_8c.html#a3e00faf7fbf9805e9ec4d2edd6339050">month</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint8_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="log_8c.html#a72369a1087b2aeffe374bb054cb97c12">day</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint8_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="log_8c.html#acf7d2d98117c452b351c130883b70eba">wday</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">uint8_t&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="log_8c.html#affc83957945e425377d69c855b6efb49">logbuff</a> [8]</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Bufor do przechowania zdarzenia z logu.  <a href="#affc83957945e425377d69c855b6efb49"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Opis szczegółowy</h2>
<p>Implementacja loga systemowego. </p>
<p>Cała dostępna pamięć loga podzielona jest na 8 bajtowe rekordy. Przykładowo dla pamięci 24c64 (o pojemności 64k) możliwe jest dokonanie 1024 rekordów do logu od numeru 0 do 1023. Rekord o numerze 0 jest rekordem kontrolnym.</p>
<p>Wskaźnik 16-bitowy do wpisu przechowywany jest domyślnie w 6 i 7 bajcie rekordu kontrolnego (<a class="el" href="log_8h.html#a3842545574e0dc363291d2b34c46c4b8">LOG_CONTROL_POINTER_LSB</a> i <a class="el" href="log_8h.html#a56bc3b0d1adcb24b63076f64f8f7f9b5">LOG_CONTROL_POINTER_MSB</a>).</p>
<div class="fragment"><pre class="fragment">
 0| 1| 2| 3| 4| 5| 6| 7| - pierwsze 8 bajtów w pamięci
                  XX     - LOG_CONTROL_POINTER_LSB (mniej znacząca cześć wskaźnika)
                     XX  - LOG_CONTROL_POINTER_MSB (bardziej znacząca cześć wskaźnika)
</pre></div><p>Rekord przechowujący zdarzenia:</p>
<div class="fragment"><pre class="fragment">
 00|01|02|03|04|05|06|07| - rekord (wpis w logu)   8 bajtów
 XX                       - rok
    X                     - miesiąc
     X                    - typ                    możliwe 16 typów zdarzeń
       XX                 - dzień
          XX              - godzina
             XX           - minuty
                X         - wartość1/2             bit 7 określa czy zdarzenie się rozpoczyna czy kończy
                 X        - wartość2/2             zawiera identyfikator elementu wywołujacego zdarzenie
                   XX     - wartosc2               dodatkowe informacje
                      XX  - wartosc3               dodatkowe informacje
</pre></div><p> Typy zdarzeń wymienione są w pliku ze wspólnymi definicjami <a class="el" href="commonDefs_8h.html">commonDefs.h</a> </p>
<hr/><h2>Dokumentacja funkcji</h2>
<a class="anchor" id="a7ec3e7bfdff671647c3b5f970e269416"></a><!-- doxytag: member="log.c::log_clear" ref="a7ec3e7bfdff671647c3b5f970e269416" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void log_clear </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Czyści cały log </p>

</div>
</div>
<a class="anchor" id="a06b5b6528e09e9739123d051949bfef5"></a><!-- doxytag: member="log.c::log_clear_record" ref="a06b5b6528e09e9739123d051949bfef5" args="(uint16_t logp)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void log_clear_record </td>
          <td>(</td>
          <td class="paramtype">uint16_t&nbsp;</td>
          <td class="paramname"> <em>logp</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Czyści rekord w logu </p>
<dl><dt><b>Parametry:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>logp</em>&nbsp;</td><td>wartość wskaźnika </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a3738b2ee3ff807b7d474a41d2e3ac718"></a><!-- doxytag: member="log.c::log_read_pointer" ref="a3738b2ee3ff807b7d474a41d2e3ac718" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint16_t log_read_pointer </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Zwraca wskaźnik </p>
<dl class="return"><dt><b>Zwraca:</b></dt><dd>wartość wskaźnika </dd></dl>

</div>
</div>
<a class="anchor" id="ae936d9a5aed8334fd48eb6951c71e4d5"></a><!-- doxytag: member="log.c::log_read_record_at_pointer" ref="ae936d9a5aed8334fd48eb6951c71e4d5" args="(uint16_t logp, uint8_t *pbuff)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void log_read_record_at_pointer </td>
          <td>(</td>
          <td class="paramtype">uint16_t&nbsp;</td>
          <td class="paramname"> <em>logp</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&nbsp;</td>
          <td class="paramname"> <em>pbuff</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Czyta wpis z loga </p>
<dl><dt><b>Parametry:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>logp</em>&nbsp;</td><td>wartość wskaźnika </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>*pbuff</em>&nbsp;</td><td>wskaźnik do bufora, gdzie zostanie zapisany wpis </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a2e029451a7bcce372537c4c50805a4df"></a><!-- doxytag: member="log.c::log_write_pointer" ref="a2e029451a7bcce372537c4c50805a4df" args="(uint16_t pointer)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void log_write_pointer </td>
          <td>(</td>
          <td class="paramtype">uint16_t&nbsp;</td>
          <td class="paramname"> <em>pointer</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Ustawia wskaźnik wpisu </p>
<dl><dt><b>Parametry:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>pointer</em>&nbsp;</td><td>wartość wskaźnika </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="adc6300536924bb78d7e3d0edff452241"></a><!-- doxytag: member="log.c::log_write_record" ref="adc6300536924bb78d7e3d0edff452241" args="(uint8_t type, uint8_t val1, uint8_t val2, uint8_t val3)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void log_write_record </td>
          <td>(</td>
          <td class="paramtype">uint8_t&nbsp;</td>
          <td class="paramname"> <em>type</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&nbsp;</td>
          <td class="paramname"> <em>val1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&nbsp;</td>
          <td class="paramname"> <em>val2</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&nbsp;</td>
          <td class="paramname"> <em>val3</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Wpisuje kolejne zdarzenie do logu. </p>
<dl><dt><b>Parametry:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>type</em>&nbsp;</td><td>typ wpisu </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>val1</em>&nbsp;</td><td>warotść 1 </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>val2</em>&nbsp;</td><td>warotść 2 </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>val3</em>&nbsp;</td><td>warotść 3 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a88d1aa3d831dc4457de385a06552303b"></a><!-- doxytag: member="log.c::log_write_record_at_pointer" ref="a88d1aa3d831dc4457de385a06552303b" args="(uint16_t logp, uint8_t type, uint8_t val1, uint8_t val2, uint8_t val3)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void log_write_record_at_pointer </td>
          <td>(</td>
          <td class="paramtype">uint16_t&nbsp;</td>
          <td class="paramname"> <em>logp</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&nbsp;</td>
          <td class="paramname"> <em>type</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&nbsp;</td>
          <td class="paramname"> <em>val1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&nbsp;</td>
          <td class="paramname"> <em>val2</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&nbsp;</td>
          <td class="paramname"> <em>val3</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Wpisuje kolejne zdarzenie do logu we wskazanym przez wskaźnik miejscu. </p>
<dl><dt><b>Parametry:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>logp</em>&nbsp;</td><td>wskaźnik rekordu </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>type</em>&nbsp;</td><td>typ wpisu </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>val1</em>&nbsp;</td><td>warotść 1 </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>val2</em>&nbsp;</td><td>warotść 2 </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>val3</em>&nbsp;</td><td>warotść 3 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/><h2>Dokumentacja zmiennych</h2>
<a class="anchor" id="a72369a1087b2aeffe374bb054cb97c12"></a><!-- doxytag: member="log.c::day" ref="a72369a1087b2aeffe374bb054cb97c12" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t <a class="el" href="ui_8c.html#a72369a1087b2aeffe374bb054cb97c12">day</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="a00a531a34a1d603329df5778f1203ab6"></a><!-- doxytag: member="log.c::hours" ref="a00a531a34a1d603329df5778f1203ab6" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t <a class="el" href="ui_8c.html#a00a531a34a1d603329df5778f1203ab6">hours</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="affc83957945e425377d69c855b6efb49"></a><!-- doxytag: member="log.c::logbuff" ref="affc83957945e425377d69c855b6efb49" args="[8]" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t <a class="el" href="log_8h.html#affc83957945e425377d69c855b6efb49">logbuff</a>[8]</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Bufor do przechowania zdarzenia z logu. </p>

</div>
</div>
<a class="anchor" id="a7acca8be0094a19be6e308ac05924c4f"></a><!-- doxytag: member="log.c::minutes" ref="a7acca8be0094a19be6e308ac05924c4f" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t <a class="el" href="ui_8c.html#a7acca8be0094a19be6e308ac05924c4f">minutes</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="a3e00faf7fbf9805e9ec4d2edd6339050"></a><!-- doxytag: member="log.c::month" ref="a3e00faf7fbf9805e9ec4d2edd6339050" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t <a class="el" href="ui_8c.html#a3e00faf7fbf9805e9ec4d2edd6339050">month</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="a3cc119cb1a4beab046568bd21fcac3e5"></a><!-- doxytag: member="log.c::temp" ref="a3cc119cb1a4beab046568bd21fcac3e5" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t <a class="el" href="rtc_8c.html#a3cc119cb1a4beab046568bd21fcac3e5">temp</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="acf7d2d98117c452b351c130883b70eba"></a><!-- doxytag: member="log.c::wday" ref="acf7d2d98117c452b351c130883b70eba" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t <a class="el" href="ui_8c.html#acf7d2d98117c452b351c130883b70eba">wday</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="a7af2065789bc84419b8d5fe109be83b5"></a><!-- doxytag: member="log.c::year" ref="a7af2065789bc84419b8d5fe109be83b5" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t <a class="el" href="ui_8c.html#a7af2065789bc84419b8d5fe109be83b5">year</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
</div>
<hr size="1">
<div style="text-align: center;">
<small>Projekt udostępniony jest na zasadach Open Source. Zapoznaj się z warunkami licencji w pliku COPYING znajdujacym się w katalogu głównym.	</small>
</div>

<hr size="1">
<div style="text-align: center;">
Aquamat - sterownik akwarystyczny Open Source
<br/>
Copyright (C) 2009  <a href="http://todryk.pl">Wojciech Todryk</a> (wojciech(at)todryk(dot)pl)
</div>

<div style="text-align: right;">
<small>Dokumentację wygenerowano za pomocą programu&nbsp;</small>
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a>
<small> wersja 1.6.1 (Fri Apr 23 22:48:16 2010)&nbsp;</small>
</div>
